-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/http api new approach #348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
9a3a6aa
to
aa2b625
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This review covers only the early parts of routing and dispatching.
Oh, and I got the postgres tests working in my environment. Please get back to me for this. |
1705125
to
fe816f8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have looked at channels and contact tests so far, next I will look at contactgroup tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add following changes as well:
- The PHPDoc for the method must contain a newline between different annotations, i.e.
@param
,@return
. - Update method PHPDoc if required.
- Make the
getPlural()
method protected. - Remove the resolved todos.
30b0b1b
to
da665ca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's discuss how we handle the openapi description and the usage of Swagger, as there are three possible solutions for me:
- Caching (properly, not the way it's right now ;) )
- CI (as your todo suggests)
- Static (it's a versioned api after all)
{ | ||
if ( | ||
! preg_match('/([^;]*);?/', $request->getHeader('Content-Type'), $matches) | ||
|| $matches[1] !== 'application/json' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ApiV1::getValidRequestBody()
throws in this case- This returns null, effectively preventing any handling of non-JSON
I must ask: Why does this not throw already? Or why does it check for JSON?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing license header. It seems, not only this file is missing it, please make sure all PHP files have one.
ad9e5e8
to
00d3880
Compare
3863707
to
06a2750
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't worry, I didn't take a look at the validation/middleware stuff again 😜
$response = new Response( | ||
500, | ||
['Content-Type' => 'application/json'], | ||
Json::sanitize(['message' => 'An error occurred, please chack the log.']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
* @param string $message The log message | ||
* @param array $context Additional context variables to interpolate in the message | ||
*/ | ||
public function log($level, $message, array $context = []): void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$message
isn't typed yet
|
||
namespace Icinga\Module\Notifications\Api\OpenApiDescriptionElements\Responses; | ||
|
||
use cebe\openapi\spec\Parameter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused, pls remove
|
||
namespace Icinga\Module\Notifications\Api\Util; | ||
|
||
class BinaryUuidConverter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this keeps being unused, please drop it
Initial setup for the new approach of the http-api with openapi description.
Resolves:
require:
external_uuid
tocontact/contactgroup
table icinga-notifications#216